package com.kpx.app.activity;

import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.kpx.app.R;
import com.kpx.app.base.ActivityBase;
import com.kpx.app.bean.OrderBean;
import com.kpx.app.configs.Constants;
import com.kpx.app.utils.UIUtils;
import com.kpx.app.utils.uiutils.ToastUtil;
import com.kpx.app.view.TitleView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by congdy on 17/4/16.
 */

public class ActivityWuliuInfoShow extends ActivityBase {
    @BindView(R.id.titleview)
    TitleView titleview;
    @BindView(R.id.img_icon)
    ImageView imgIcon;
    @BindView(R.id.txt_name)
    TextView txtName;
    @BindView(R.id.txt_wuliu)
    TextView txtWuliu;
    @BindView(R.id.txt_wuliu_id)
    TextView txtWuliuId;
    @BindView(R.id.txt_copy)
    TextView txtCopy;
    private OrderBean b;

    @Override
    public void initview(@Nullable Bundle savedInstanceState) {
        setContentView(R.layout.activity_wuliu_info_show);
        ButterKnife.bind(this);
        UIUtils.setNormalTitle(titleview,"物流信息");
    }

    @Override
    public void initData() {
        b = (OrderBean) getIntent().getExtras().getSerializable(Constants.KEY_ORDER_BEAN);
        if(b !=null){
            Glide.with(this).load(b.getTaskGoods().getMainPic()).into(imgIcon);
            txtName.setText(b.getTaskGoods().getGoodsName());
            txtWuliu.setText("物流公司："+b.getLogistics());
            txtWuliuId.setText("物流编号："+b.getLogisticsNum());
        }
    }

    @Override
    public void onReceiver(Context context, Intent intent) {

    }


    @OnClick(R.id.txt_copy)
    public void onViewClicked() {
        ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
        // 将文本内容放到系统剪贴板里。
        cm.setText(b.getLogisticsNum());
        ToastUtil.getInstance().showToast(this,"复制成功！");
    }
}
